<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="省区" prop="provArea">
        <el-input
          v-model="queryParams.provArea"
          placeholder="请输入省区"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      
      
      <el-form-item label="采购方式" prop="procurementMethod">
        <el-select v-model="queryParams.procurementMethod" placeholder="请选择采购方式" clearable size="small">
          <el-option
            v-for="dict in procurementMethodOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      
     
      <el-form-item label="签约状态" prop="signStatus">
        <el-select v-model="queryParams.signStatus" placeholder="请选择签约状态" clearable size="small">
          <el-option
            v-for="dict in signStatusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="属性" prop="attribute">
        <el-select v-model="queryParams.attribute" placeholder="请选择属性" clearable size="small">
          <el-option
            v-for="dict in attributeOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
      <!--<el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>-->
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['infoInnovation:infoInnovation:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['infoInnovation:infoInnovation:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['infoInnovation:infoInnovation:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleView"
        >查看</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['infoInnovation:infoInnovation:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
          <el-upload
                ref="upload"
                :headers="upload.headers"
                :action="upload.url"
                :disabled="upload.isUploading"
                :on-progress="handleFileUploadProgress"
                :on-success="handleFileSuccess"
                :show-file-list="false"
            >
            <el-button size="small" type="primary" icon="el-icon-upload2"> 导入 </el-button>
          </el-upload>
      </el-col>
    

    </el-row>
    <el-table v-loading="loading" :data="infoInnovationList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="序号" align="center" type="index"  width="50"/>
      <el-table-column prop="expenseTime" align="center" label="更新时间" width="100">
          <template slot-scope="scope">
              <span>{{scope.row.updateTime | formatTime('yyyy-MM-dd')}}</span>
          </template>
      </el-table-column>
      <el-table-column label="项目名称" align="center" prop="projectName"  width="160"/>
      <el-table-column label="省区" align="center" prop="provArea" />
      <el-table-column label="省本级" align="center" prop="provSelf" />
      <el-table-column label="省会及主要城市" align="center" prop="mainCity" />
      <el-table-column label="竞争对手" align="center" prop="keyCompetitors" width="100"/>
      <el-table-column label="销售责任人" align="center" prop="salesMan" width="100"/>
      <el-table-column label="具体进展情况" align="center" prop="specificProgress" width="180" >
          <template slot-scope="scope">
            <span @mouseenter="showContent(scope.row.id,scope.row.specificProgress)" @mouseleave="hideContent()">{{ scope.row.specificProgress | longTextFormat() }}</span>
          </template>
      </el-table-column>
      <el-table-column label="问题" align="center" prop="problem" width="180">
         <template slot-scope="scope">
            <span>{{ scope.row.problem | longTextFormat() }}</span>
          </template>
      </el-table-column>
      <el-table-column label="建议" align="center" prop="suggest" width="180" >
         <template slot-scope="scope">
            <span>{{ scope.row.suggest | longTextFormat() }}</span>
          </template>
      </el-table-column>
      <el-table-column label="总预算" align="center" prop="generalBudget" />
      <el-table-column label="目标金额" align="center" prop="targetAmount" />
      <el-table-column label="三年进度安排" align="center" prop="threeYearSchedule" width="180"/>
      <el-table-column label="预计招标时间" align="center" prop="estimatedBiddingTime" width="100">
        <template slot-scope="scope">
          <span>{{ scope.row.estimatedBiddingTime | formatTime('yyyy-MM-dd') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="采购方式（是否分包）" align="center" prop="procurementMethod" :formatter="procurementMethodFormat" />
      <el-table-column label="成功率%" align="center" prop="successRate" />
      <el-table-column label="项目运作方式" align="center" prop="projectRunType" :formatter="projectRunTypeFormat" width="180"/>
    
      <el-table-column label="签约状态" align="center" prop="signStatus" :formatter="signStatusFormat" />
      <el-table-column label="属性" align="center" prop="attribute" :formatter="attributeFormat" />
    </el-table>
 
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改信创进度对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px">
      <el-form ref="form" :model="form" :rules="rules" label-width="160px">
        <el-form-item label="属性" prop="id" style="display:none;">
          <el-input v-model="form.id" placeholder="请输入属性" />
        </el-form-item>
        <el-row>
          <el-col :span="24">
             <el-form-item label="项目名称(目标单位)" prop="projectName">
              <el-input v-model="form.projectName" placeholder="项目名称(目标单位)" />
             </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
             <el-form-item label="省区" prop="provArea">
              <el-input v-model="form.provArea" placeholder="请输入省区" />
             </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="省本级" prop="provSelf">
              <el-input v-model="form.provSelf" placeholder="请输入省本级" />
            </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="12">
            <el-form-item label="省会及主要城市" prop="mainCity">
              <el-input v-model="form.mainCity" placeholder="请输入省会及主要城市" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="竞争对手" prop="keyCompetitors">
              <el-input v-model="form.keyCompetitors" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="销售责任人" prop="salesMan">
              <el-input v-model="form.salesMan" placeholder="请输入销售责任人" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="总预算" prop="generalBudget">
              <el-col :span="16">
                  <el-input v-model="form.generalBudget" type="number" oninput="if(value.length>11)value=value.slice(0,11)" placeholder="请输入总预算" />
              </el-col>
              <el-col :span="8">
                  （万元）
              </el-col>
              
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="目标金额" prop="targetAmount">
              <el-col :span="20">
                  <el-input v-model="form.targetAmount" type="number" oninput="if(value.length>11)value=value.slice(0,11)" placeholder="请输入目标金额" width="90%"/>
              </el-col>
              <el-col :span="4">
                  （万元）
              </el-col>
              
            </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="24">
             <el-form-item label="三年进度安排" prop="threeYearSchedule">
              <el-input v-model="form.threeYearSchedule" oninput="if(value.length>150)value=value.slice(0,150)" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="预计招标时间" prop="estimatedBiddingTime">
              <el-date-picker clearable size="small" style="width: 200px"
                v-model="form.estimatedBiddingTime"
                type="date"
                value-format="yyyy-MM-dd"
                placeholder="选择预计招标时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采购方式（是否分包）">
              <el-select v-model="form.procurementMethod" placeholder="请选择采购方式">
                <el-option
                  v-for="dict in procurementMethodOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="成功率%" prop="successRate">
              <el-col :span="22">
                  <el-input v-model="form.successRate" type="number" oninput="if(value.length>5)value=value.slice(0,5)" placeholder="请输入成功率%" />
              </el-col>
              <el-col :span="2">
                  %
              </el-col>
              
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="项目运作方式">
              <el-select v-model="form.projectRunType" placeholder="请选择项目运作方式">
                <el-option
                  v-for="dict in projectRunTypeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
               <el-form-item label="具体进展情况" prop="specificProgress">
                <el-input v-model="form.specificProgress" oninput="if(value.length>150)value=value.slice(0,150)" type="textarea" placeholder="请输入内容" />
              </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
                <el-form-item label="问题" prop="problem">
                  <el-input v-model="form.problem" oninput="if(value.length>150)value=value.slice(0,150)" type="textarea" placeholder="请输入内容" />
                </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="24">
              <el-form-item label="建议" prop="suggest">
                <el-input v-model="form.suggest" oninput="if(value.length>150)value=value.slice(0,150)" type="textarea" placeholder="请输入内容" />
              </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="签约状态">
              <el-select v-model="form.signStatus" placeholder="请选择签约状态">
                <el-option
                  v-for="dict in signStatusOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
             <el-form-item label="属性">
              <el-select v-model="form.attribute" placeholder="请选择属性">
                <el-option
                  v-for="dict in attributeOptions"
                  :key="dict.dictValue"
                  :label="dict.dictLabel"
                  :value="dict.dictValue"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="viewOpen" width="800px">
      <el-form ref="form" :model="form" :rules="rules" label-width="180px">
        <el-row>
          <el-col :span="24">
             <el-form-item label="项目名称(目标单位)" prop="projectName">
              {{form.projectName}}
             </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
             <el-form-item label="省区" prop="provArea">
              {{form.provArea}}
             </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="省本级" prop="provSelf">
              {{form.provSelf}}
            </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="12">
            <el-form-item label="省会及主要城市" prop="mainCity">
              {{form.mainCity}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="竞争对手" prop="keyCompetitors">
              {{form.keyCompetitors}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="销售责任人" prop="salesMan">
              {{form.salesMan}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="总预算" prop="generalBudget">
              {{form.generalBudget}}（万元）
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="目标金额" prop="targetAmount">
              {{form.targetAmount}}（万元）
            </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="24">
             <el-form-item label="三年进度安排" prop="threeYearSchedule">
              {{form.threeYearSchedule}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="预计招标时间" prop="estimatedBiddingTime">
              {{ form.estimatedBiddingTime | formatTime('yyyy-MM-dd') }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采购方式（是否分包）">
              {{procurementMethodFormat(form)}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="成功率%" prop="successRate">
              {{form.successRate}}%
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="项目运作方式">
              {{projectRunTypeFormat(form)}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
               <el-form-item label="具体进展情况" prop="specificProgress">
                {{form.specificProgress}}
              </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
                <el-form-item label="问题" prop="problem">
                  {{form.problem}}
                </el-form-item>
          </el-col>
        </el-row>
       <el-row>
          <el-col :span="24">
              <el-form-item label="建议" prop="suggest">
                {{form.suggest}}
              </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="签约状态">
              {{signStatusFormat(form)}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
             <el-form-item label="属性">
              {{attributeFormat(form)}}
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <div id="showDiv" v-if="showIt">{{showText}}</div>
  </div>
</template>

<script>
import { listInfoInnovation, getInfoInnovation, delInfoInnovation, addInfoInnovation, updateInfoInnovation, exportInfoInnovation ,getUser,importInfoInnovation} from "@/api/infoInnovation/infoInnovation";
import { getToken } from "@/utils/auth";
export default {
  name: "InfoInnovation",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 信创进度表格数据
      infoInnovationList: [],
      showIt:false,
      showText:'',
      notifications: {},
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      viewOpen:false,
      // 采购方式字典
      procurementMethodOptions: [],
      // 项目运作方式字典
      projectRunTypeOptions: [],
      // 签约状态字典
      signStatusOptions: [],
      // 属性字典
      attributeOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        provArea: undefined,
        provSelf: undefined,
        mainCity: undefined,
        keyCompetitors: undefined,
        salesMan: undefined,
        generalBudget: undefined,
        targetAmount: undefined,
        threeYearSchedule: undefined,
        estimatedBiddingTime: undefined,
        procurementMethod: undefined,
        successRate: undefined,
        projectRunType: undefined,
        specificProgress: undefined,
        problem: undefined,
        suggest: undefined,
        signStatus: undefined,
        attribute: undefined
      },
      // 表单参数
      form: {},
      upload: {
                // 弹出层标题（用户导入）
                title: "",
                // 是否禁用上传
                isUploading: false,
                // 设置上传的请求头部
                headers: { Authorization: "Bearer " + getToken() },
                // 上传的地址
                url: process.env.VUE_APP_BASE_API + "/common/upload"
            },
      fileInfoList:[],
      // 表单校验
      rules: {
        /*generalBudget:[
            { message: "总预算数据格式错误", trigger: "blur"},
            {
                pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/,
                message: "请输入正确的金额",
                trigger: "blur"
            }
        ],
        targetAmount:[
            { message: "目标金额数据格式错误", trigger: "blur"},
            {
                pattern: /((^[1-9]\d*)|^0)(\.\d{0,2}){0,1}$/,
                message: "请输入正确的金额",
                trigger: "blur"
            }
        ],
        successRate:[
            { message: "成功率数据格式错误", trigger: "blur"},
            {
                pattern: /^(100|[1-9]?\d(\.\d\d?\d?)?)$|0$/,
                message: "请输入正确的数值",
                trigger: "blur"
            }
        ]*/
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("sys_yes_no").then(response => {
      this.procurementMethodOptions = response.data;
    });
    this.getDicts("project_run_type").then(response => {
      this.projectRunTypeOptions = response.data;
    });
    this.getDicts("project_sign_status").then(response => {
      this.signStatusOptions = response.data;
    });
    this.getDicts("project_attribute").then(response => {
      this.attributeOptions = response.data;
    });
  },
  methods: {
    /** 查询信创进度列表 */
    getList() {
      this.loading = true;
      listInfoInnovation(this.queryParams).then(response => {
        this.infoInnovationList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 采购方式字典翻译
    procurementMethodFormat(row, column) {
      return this.selectDictLabel(this.procurementMethodOptions, row.procurementMethod);
    },
    // 项目运作方式字典翻译
    projectRunTypeFormat(row, column) {
      return this.selectDictLabel(this.projectRunTypeOptions, row.projectRunType);
    },
    // 签约状态字典翻译
    signStatusFormat(row, column) {
      return this.selectDictLabel(this.signStatusOptions, row.signStatus);
    },
    // 属性字典翻译
    attributeFormat(row, column) {
      return this.selectDictLabel(this.attributeOptions, row.attribute);
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.viewOpen = false;
      this.reset();
    },
    // 表单重置
    reset() {
       getUser().then(response => {
        this.form = {
          id: undefined,
          projectName: undefined,
          provArea: undefined,
          provSelf: undefined,
          mainCity: undefined,
          keyCompetitors: undefined,
          salesMan: response.data.user.nickName,
          generalBudget: undefined,
          targetAmount: undefined,
          threeYearSchedule: undefined,
          estimatedBiddingTime: undefined,
          procurementMethod: undefined,
          successRate: undefined,
          projectRunType: undefined,
          specificProgress: undefined,
          problem: undefined,
          suggest: undefined,
          signStatus: undefined,
          attribute: undefined
        };
        this.resetForm("form");
      });
      
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加信创进度";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getInfoInnovation(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改信创进度";
      });
    },
    handleView(row){
      this.reset();
      const id = row.id || this.ids
      getInfoInnovation(id).then(response => {
        this.form = response.data;
        this.viewOpen = true;
        this.title = "查看信创进度";
      });
    },
    /** 提交按钮 */
    submitForm: function() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != undefined) {
            updateInfoInnovation(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          } else {
            addInfoInnovation(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              } else {
                this.msgError(response.msg);
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm('是否确认删除信创进度编号为"' + ids + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delInfoInnovation(ids);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有信创进度数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportInfoInnovation(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    },
    showContent(id,text){
      const h = this.$createElement;
       let notify =  this.$notify({
          message: h('i', { style: 'color: teal'}, text)
        });
      this.notifications[id] = notify;
    },
    hideContent(){
      let _this = this;
      for (let key in _this.notifications) {
        _this.notifications[key].close();
        delete _this.notifications[key];
      }
    },
     // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
          this.upload.isUploading = true;
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
          this.upload.isUploading = false;
          let path = response.fileName;
          importInfoInnovation({filePath:path}).then(response => {
            if(response.data != '1'){
              this.msgError(response.msg);
            }else{
              this.msgSuccess("导入成功");
              this.handleQuery();
            }
              
          });
          
      },
    tableRowClassName(row){
      let aData = new Date();
      let a = this.formatTime(aData,'yyyy-MM-dd');
      let b = this.formatTime(row.row.updateTime,'yyyy-MM-dd')
      if( a=== b){
          return 'todayCalss';
      }else{
        return;
      }
    },
    formatTime(date, fmt){
          var date = new Date(date);
          if (/(y+)/.test(fmt)) {
              fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
          }
          var o = {
              'M+': date.getMonth() + 1,
              'd+': date.getDate(),
              'h+': date.getHours(),
              'm+': date.getMinutes(),
              's+': date.getSeconds()
          };
          for (var k in o) {
              if (new RegExp('('+k+')').test(fmt)) {
                  var str = o[k] + '';
                  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : ('00' + str).substr(str.length));
              }
          }
          return fmt;
    }
  },
  filters: {
      longTextFormat(text){
        if(text.length > 30){
          return text.substring(0,30)+'...';
        }else{
          return text;
        }
      },
      formatTime: function (date, fmt) {
          var date = new Date(date);
          if (/(y+)/.test(fmt)) {
              fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
          }
          var o = {
              'M+': date.getMonth() + 1,
              'd+': date.getDate(),
              'h+': date.getHours(),
              'm+': date.getMinutes(),
              's+': date.getSeconds()
          };
          for (var k in o) {
              if (new RegExp('('+k+')').test(fmt)) {
                  var str = o[k] + '';
                  fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : ('00' + str).substr(str.length));
              }
          }
          return fmt;
      }
  }
};
</script>
<style scoped>
  .el-table{min-height:300px;max-height:380px;width:99%;overflow-x: auto;overflow-y: auto;}
  .el-table .todayCalss{color:red}
  .el-table .el-table__header-wrapper{max-height:50px;width:2300px;}
  .el-table .el-table__header-wrapper .cell{line-height: 14px;}
  .el-table .el-table__body-wrapper{width:2300px;}
  #showDiv{
    display:none;position: absolute; width:200px;height:20px;background-color: #DCDCDC; border: 1px solid black;
  }
</style>